package com.javashow.main.menu.dao.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import com.javashow.main.menu.dao.IMainMenuDao;
import com.javashow.pojo.MainMenu;

@Repository("mainMenuDao")
public class MainMenuDaoImpl implements IMainMenuDao {
	
	@Resource
	private SessionFactory sessionFactory;
	
	@SuppressWarnings("unchecked")
	@Override
	public List<MainMenu> queryMainMenu() {
		List<MainMenu> result = new ArrayList<MainMenu>();
		
		Session session = sessionFactory.getCurrentSession();
		
		Query query = session.createQuery("from MainMenu");
		
		result = query.list();
		
		return result;
	}

}
	